﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ControllerStudy2.Controllers
{
    public class FileIOController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Info = new[] { "", "", "" };
            return View();
        }

        public ActionResult Save(String MaSV, String HoTen, double Diem)
        {
            var info = new []{MaSV, HoTen, Diem.ToString()};
            System.IO.File.WriteAllLines("c:/temp/sv.txt", info);

            ViewBag.Info = new[] { "", "", "" };
            return View("Index");
        }

        public ActionResult Open()
        {
            var info = System.IO.File.ReadAllLines("c:/temp/sv.txt");
            ViewBag.Info = info;
            return View("Index");
        }
	}
}